package com.example.demo.service.impl;

import com.example.demo.model.Nutritionalvalue;
import com.example.demo.repository.NutritionalValueRepository;
import com.example.demo.service.NutritionalValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class NutritionalValueServiceImpl implements NutritionalValueService {
    private final NutritionalValueRepository nutritionalValueRepository;

    @Autowired
    public NutritionalValueServiceImpl(NutritionalValueRepository nutritionalValueRepository) {
        this.nutritionalValueRepository = nutritionalValueRepository;
    }


    @Override
    public Nutritionalvalue getDishNutritionalValue(String name) {
        return nutritionalValueRepository.findByName(name);
    }

    @Override
    public Nutritionalvalue getIngredientNutritionalValue(String name) {
        return nutritionalValueRepository.findByName(name);
    }
}
